var express = require('express')
var serveIndex = require('serve-index')
var serveStatic = require('serve-static')
var multiparty = require('multiparty')
var util = require('util')

var LOCAL_BIND_PORT = 3000
var app = express()


app.use(express.static('/'))

app.get('/test.html',function(req,res){
    res.sendFile(__dirname+'/'+'test.html');
});

console.log(__dirname);
console.log(__filename);

app.get('/form_get',function(req,res){
    console.log('主页 post请求');//后台打印一个信息，表示正在执行
    var response={//解码接收到的字符串，并存放在response对象（或者叫数组中）
        'first':req.query.first,
        'second':req.query.second
    }
    console.log(req.query);
    res.write("first：" + req.query.first);//将收到的表单数据解析之后原封不动的发回去
	res.write("\n");
	res.write("second:" + req.query.second);
    res.end();
});


console.log(`Start static file server at ::${LOCAL_BIND_PORT}, Press ^ + C to exit`)
app.listen(LOCAL_BIND_PORT)
